export default{
    getCookie(key){
            const arr=document.cookie.split("; ")
            for(let i=0;i<arr.length;i++){
                if(arr[i].split("=")[0]===key){
                    return arr[i].split("=")[1];
                }  
    }
    },
    setCookie(key,val,ops={}){
        let dateStr=""
        if(ops.expires){
            let d = new Date();
            dateStr=";expires="+d.setDate(d.getDate()+ops.expires);
        }
        let path=""
        if(ops.path){
            path=";path="+ops.path
        }
        document.cookie=`${key}=${val}${dateStr}${path}`
    },
     removeCookie(key,ops={}){
        ops.expires=-1;
        this.setCookie(key,'',ops)
    }

}